﻿using System;
using UnityEngine;

public class PauseMenu : MonoBehaviour
{
	public static bool paused = false;
	
	void Update()
	{
		if(Input.GetKeyDown(KeyCode.Escape))
			paused = togglePause();
	}
	
	void OnGUI()
	{
		if(paused)
		{
			GUILayout.Label("The game has been paused");
			if(GUILayout.Button("Hit ESC or press here to unpause"))
				paused = togglePause();

			if(GUILayout.Button ("Click to upgrade Hull to level " + (ShipModuleData.hullLv + 1)))
				ShipModuleData.hullLv = ShipModuleData.hullLv + 1;

		}
	}
	
	bool togglePause()
	{
		if(Time.timeScale == 0f)
		{
			Time.timeScale = 1f;
			return(false);
		}
		else
		{
			Time.timeScale = 0f;
			return(true);
		}
	}
}